<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 导入semantic的样式 -->
<jsp:include page="../head.jsp">
<jsp:param value="职位管理" name="title"/>
</jsp:include>
<script type="text/javascript">
	
	$(function(){
		//点击创建和修改按钮侧边弹出
		$(".createButton").click(function(){
			$(".container").css("width","70%");
			$(".rightdiv").css("display","block");
			location.href("position/form?postStatus=1&pid=" + $(this).attr('value'));
		});
		$("#clo").click(function(){
			$(".rightdiv").css("display","none");
			$(".container").css("width","100%");
		});
		
	});
</script>
</head>
<body >
<div class="container">
	<div class="row">
			<div id="content" class="col-lg-12">
				<div class = "dao">		
					<p>职位管理</p>					
				</div>
					<div class="col-md-12">
						<!-- BOX -->
						<div class="box border blue">
							<div class="box-title">
								<h4>职位列表</h4>
							</div>
							<div class="dataTables_header clearfix">
							   <div class="col-md-4">
							   <div style = "padding: 10px">
								<div style = "width:400px">
									<a  class="ui button createButton"> <i class="icon user"></i>
										创建职位
									</a>
									<button class="ui button" id="postDelete">
										<i class="icon trash"></i> 批量删除
									</button>
								</div>
									<span style="color:red;">${error }</span>	
							</div>
							    </div>
							   </div>
							<div class="box-body center">
								<table id="datatable2" cellpadding="0" cellspacing="0" border="0" class="datatable table table-striped table-bordered table-hover">
									<thead >
										<tr style = "text-align: center">
											<th>
												<div>
													<input type="checkbox" id="checkAll">
												</div>
											</th>
											<th>职位名称</th>
											<th class="hidden-xs">职位描述</th>
											<th>编辑&nbsp;删除</th>
											
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${positionList }" var="post">
										<tr class="gradeX">
											<td>
												<div>
													<input class="item-check input" type="checkbox" value="${post.postId }">
												</div>
												
											</td>
											<td><a href="position/form?pid=${post.postId }">${post.postName}</a></td>
											<td>${post.postDescribe}</td>
											<td><a class = "createButton" value = "${post.postId}"> <i class="icon edit "></i></a>
												&nbsp;
												<a onclick="return confirm('确认删除？')"
													href="position/delete?id=${post.postId}&postStatus=1" > <i class="icon trash"></i> 
												</a></td>
												</tr>
											</div>
										</div>
										<!-- /BOX -->
									</div>
								</div>
								</c:forEach>
							<!-- /EXPORT TABLES -->
							<c:if test="${empty positionList}">
								<tr>
									<td style="text-align: center;" colspan="4">暂无记录</td>
								</tr>
							</c:if>
						</tbody>
					</table>
					<c:if test="${totalPage > 1 }">
						<div class="page">
							<a <c:if test="${page!=1}">href="position?page=1${queryString}"</c:if>
								class="${page == 1?'disable':''}">首页</a> <a
								<c:if test="${page!=1}">href="position?page=${page-1}${queryString}"</c:if>
								class="${page == 1?'disable':''}">上一页</a> <a
								<c:if test="${page!=totalPage}">href="position?page=${page+1 }${queryString}"</c:if>
								class="${page == totalPage?'disable':''}">下一页</a> <a
								<c:if test="${page!=totalPage}">href="position?page=${totalPage }${queryString}"</c:if>
								class="${page == totalPage?'disable':''}">最后一页</a> 
								<span  style = "float:right">${page}/${ totalPage} </span>
						</div>
					</c:if>
				</div>				
			</div>
		</div>
	</div>
</div>
	<div id = "rightDiv" class = " box border blue rightdiv">
		<img src = "img/close.png" id = "clo" style = "margin:5px"></img>
		<form  method="post" action = "position/form?postStatus=1" class="ui form create-form content" style = "max-width: 80%;">
			<!-- 如果是新建这里没有值 -->
		  <input type="hidden" name="postId" value="${post.postId}">
		  <div class="field">
		    <label>职位名称</label>
		    <input type="text" name="postName" value="${post.postName}">
		  </div>
		  
		  <div class="field">
		    <label>职位描述</label>
		    <input type="text" name="postDescribe" value="${post.postDescribe }">
		  </div>
		  <button class="ui button" type="submit">${empty post ?'创建':'保存' }</button>
		  <span>${error}</span>
		</form>
		</div>
</div>
</body>
</html>